package top.atluofu.luofuecommerce.search.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.atluofu.common.to.es.SkuEsModel;
import top.atluofu.common.utils.R;
import top.atluofu.luofuecommerce.search.service.ProductSaveServie;

import java.util.List;

/**
 * @ClassName: ElasticSaveController
 * @description: TODO
 * @author: 有罗敷的马同学
 * @datetime: 2022Year-11Month-15Day-21:09
 * @Version: 1.0
 */
@RestController
@RequestMapping("/search/save")
public class ElasticSaveController {

    @Autowired
    ProductSaveServie productSaveServie;

    @PostMapping("/product")
    public R productStatusUp(@RequestBody List<SkuEsModel> skuEsModels) {

        boolean b = productSaveServie.productStatusUp(skuEsModels);
        if (b) {
            return R.ok();
        } else {
            return R.error();
        }
    }
}
